var e = require;
var t = module;
cc.Class({
    extends: cc.Component,
    properties: {
        bgm: {type: cc.AudioClip, default: null},
        btn: {type: cc.AudioClip, default: null},
        fail: {type: cc.AudioClip, default: null},
        right: {type: cc.AudioClip, default: null},
        selected: {type: cc.AudioClip, default: null},
        unselected: {type: cc.AudioClip, default: null},
        win: {type: cc.AudioClip, default: null},
        wrong: {type: cc.AudioClip, default: null}
    },
    onLoad: function onLoad() {
        (window.soundMgr = this),
            (this.soundOn = !0),
            cc.game.addPersistRootNode(this.node),
            (this.curBgm = null),
            (this.ae = cc.audioEngine),
            (this.soundBgmId = -1);
    },
    start: function start() {},
    playBgm: function playBgm(e) {
        cc.audioEngine.playMusic(e, !0);
    },
    pauseBgm: function pauseBgm() {
        cc.audioEngine.pauseMusic();
    },
    resumeBgm: function resumeBgm() {
        cc.audioEngine.resumeMusic();
    },
    stopBgm: function stopBgm() {
        this.soundBgmId >= 0 && (this.ae.stopEffect(this.soundBgmId), (this.soundBgmId = -1));
    },
    playSound: function playSound(e, t) {
        void 0 === t && (t = !1);
        var o = -1;
        return e && this.soundOn && (t && this.ae.stopEffect(e), (o = this.ae.playEffect(e, !1))), o;
    },
    playBtn1: function playBtn1() {
        this.playSound(this.btn1);
    },
    soundOnOff: function soundOnOff(e) {
        this.soundOn ? this.playBgm(e) : this.stopBgm();
    }
});
